home *** CD-ROM | disk | FTP | other *** search
/ MacGames Sampler / PHT MacGames Bundle.iso / MacSource Folder / Samples from the CD / Assembly / Mac68k / MANUAL / MAN3.DOC < prev    next >
Encoding:
Text File  |  1985-08-20  |  13.4 KB  |  468 lines  |  [TEXT/Anon]

  1.  
  2. MAC.68K
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   II.11 ASCII Control Characters
  9.   II.11 ASCII Control Characters
  10.   II.11 ASCII Control Characters
  11.  
  12.  
  13.  
  14.  
  15.       Any ASCII control characters found in the source input will
  16.  
  17.  
  18.   be converted to # prior to processing except for:  CR ($0D), LF
  19.  
  20.  
  21.   ($0A), DLE ($10), and HT ($09) (see II.4).
  22.  
  23.  
  24.  
  25.  
  26.   II.12 Numeric Data Representation
  27.   II.12 Numeric Data Representation
  28.   II.12 Numeric Data Representation
  29.  
  30.  
  31.  
  32.  
  33.       Hex numbers begin with the symbol $, octal numbers use a
  34.  
  35.  
  36.   postfix radix character of B or Q, and decimal numbers may
  37.  
  38.  
  39.   optionally use a radix of D.  Radix and hex alpha characters may
  40.  
  41.  
  42.   be any mixture of upper and/or lower case.
  43.  
  44.  
  45.       All numbers are represented internally as 32-bit integers.
  46.  
  47.  
  48.   This places a range limit of +2**31 - 1 on the value of any
  49.                                _
  50.  
  51.  
  52.   number.
  53.  
  54.  
  55.  
  56.    Examples       DECIMAL     OCTAL         HEX
  57.  
  58.  
  59.  
  60.    unsigned          18          7Q        $1AF
  61.  
  62.  
  63.    signed          -123D       -77Q        -$30
  64.  
  65.  
  66.                      +5        +03Q        +$FF
  67.  
  68.  
  69.  
  70.  
  71.   II.13 Character Data Representation
  72.   II.13 Character Data Representation
  73.   II.13 Character Data Representation
  74.  
  75.  
  76.  
  77.  
  78.       Character data may be defined by placing the desired
  79.  
  80.  
  81.   character string within single quotes. (Double quotes are used
  82.  
  83.  
  84.   for STRING names.)
  85.  
  86.  
  87.  
  88.       MAC.68K also supports a variety of left and right justified
  89.  
  90.  
  91.   character data types. Justification occurs when the specified
  92.  
  93.  
  94.   character data is shorter than its field. For example one byte of
  95.  
  96.  
  97.   data in a word field, or 21 bytes in a 6 long word field will be
  98.  
  99.  
  100.   aligned to a left or right field boundary.  Space and zero fill
  101.  
  102.  
  103.   are available options.
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.                               -7-                               MAC.68K
  127.  
  128.  
  129.  
  130.                                                                 MAC.68K
  131.  
  132.  
  133.  
  134.  
  135.  
  136.       The general form for justified character data is:
  137.  
  138.  
  139.  
  140.          n / type / string
  141.  
  142.  
  143.  
  144.       A special form available for DC operations only is:
  145.  
  146.  
  147.  
  148.          #type / d / string / d
  149.  
  150.  
  151.  
  152.          where  n  is the field size and  d  is any character
  153.  
  154.  
  155.  
  156.  
  157.           type             description
  158.  
  159.  
  160.  
  161.            A               Right justified with blank fill
  162.  
  163.  
  164.            H               Left justified with blank fill
  165.  
  166.  
  167.            L               Left justified with zero fill
  168.  
  169.  
  170.            R               Right justified with zero fill
  171.  
  172.  
  173.            Z               Left justified with zero fill. For DC
  174.  
  175.  
  176.                            instructions, one trailing zero byte
  177.  
  178.  
  179.                            is guaranteed even if another byte, word,
  180.  
  181.  
  182.                            or long word must be allocated. Within
  183.  
  184.  
  185.                            an expression or constant, type Z is
  186.  
  187.  
  188.                            equivalent to type L.
  189.  
  190.  
  191.  
  192.       Each character data type may either have an explicit
  193.  
  194.  
  195.   character length or may use delimiter characters to bracket the
  196.  
  197.  
  198.   string. For example, 4LABCD and L*ABCD* each describe a string of
  199.  
  200.  
  201.   length 4 characters. The delimiting character may be any
  202.  
  203.  
  204.   character (other than & or ") that does not appear in the string
  205.  
  206.  
  207.   itself. The type designation character must be upper case.
  208.  
  209.  
  210.  
  211.                     Examples
  212.  
  213.  
  214.  
  215.           MOVE.L   #'ABCD',D1
  216.  
  217.  
  218.           CMP.W    #1R-,D2        Compare Right Justified Character Data
  219.  
  220.  
  221.           DC.L     22H THIS IS A LONG STRING
  222.  
  223.  
  224.           DC.B     #Z*SAMPLE ZERO BYTE TERMINATED MESSAGE*
  225.  
  226.  
  227.           DC.B     'The End'
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251. MAC.68K                                   -8-
  252.  
  253.  
  254.  
  255. MAC.68K
  256.  
  257.  
  258.  
  259.  
  260.  
  261. II.14 Expression Evaluation
  262. II.14 Expression Evaluation
  263. II.14 Expression Evaluation
  264.  
  265.  
  266.  
  267.  
  268.       Symbols and data values can be combined into expressions
  269.  
  270.  
  271.   using normal algebraic notation. A single term expression takes
  272.  
  273.  
  274.   on the value of the term involved. Multiple term expressions are
  275.  
  276.  
  277.   reduced to a single value following the rules:
  278.  
  279.  
  280.  
  281.       Unary operator    +  -
  282.  
  283.  
  284.       Binary operator   + - *  /
  285.  
  286.  
  287.  
  288.   1. Parenthesized expressions are evaluated from the innermost
  289.  
  290.  
  291.      outward.  Parenthesis can be nested to six levels.
  292.  
  293.  
  294.  
  295.   2. Arithmetic operators are evaluated left to right, with
  296.  
  297.  
  298.      multiplication and division taking precedence over addition
  299.  
  300.  
  301.      and subtraction.
  302.  
  303.  
  304.  
  305.   3. Each term is evaluated as a 32-bit value.
  306.  
  307.  
  308.  
  309.   4. Division yields a 32-bit integer with no remainder, and
  310.  
  311.  
  312.      division by zero yields zero, but it is flagged as an error.
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.                               -9-                               MAC.68K
  353.  
  354.  
  355.  
  356.                                                                 MAC.68K
  357.  
  358.  
  359.  
  360.  
  361.  
  362. III.  MACROS
  363. III.  MACROS
  364. III.  MACROS
  365.  
  366.  
  367.  
  368.  
  369.       A macro definition contains a sequence of source lines that
  370.  
  371.  
  372.   are saved, and then later inserted into the program text when
  373.  
  374.  
  375.   referenced by using the macro name as an operation code.
  376.  
  377.  
  378.  
  379.       The first line of a macro definition contains the MACRO or
  380.  
  381.  
  382.   MACROL operation code, the macro name, and any substitutable
  383.  
  384.  
  385.   parameters used within the body of the macro. Reserved macro
  386.  
  387.  
  388.   names are:  END ENDM LOCAL ENDD.
  389.  
  390.  
  391.  
  392.       Next, a macro definition may optionally contain one or more
  393.  
  394.  
  395.   LOCAL pseudo ops that identify symbols used within the body of
  396.  
  397.  
  398.   the macro that are local to the macro definition. During macro
  399.  
  400.  
  401.   expansion, local symbols are replaced with a symbol name of
  402.  
  403.  
  404.   ..hhhh where hhhh is a hex number starting at 0000 and being
  405.  
  406.  
  407.   incremented by one each time a local symbol is created. By
  408.  
  409.  
  410.   generating unique symbol names, a macro may be expanded more than
  411.  
  412.  
  413.   once without causing duplicate symbol definition errors. These
  414.  
  415.  
  416.   generated symbol names are not listed in the symbol table and are
  417.  
  418.  
  419.   not cross referenced.
  420.  
  421.  
  422.  
  423.       The body of the macro comes next. It consists of a sequence
  424.  
  425.  
  426.   of source lines terminated by an ENDM operation code. The source
  427.  
  428.  
  429.   lines may contain any combination of operation codes, comment
  430.  
  431.  
  432.   lines, or macro calls except op code END. By using named ENDM op
  433.  
  434.  
  435.   codes (see ENDM) a macro may even contain other macro
  436.  
  437.  
  438.   definitions. Note that any macros contained within another macro
  439.  
  440.  
  441.   are merely saved and not processed/defined until the outer level
  442.  
  443.  
  444.   macro is called.
  445.  
  446.  
  447.  
  448.       The name of a substitutable parameter or local symbol can
  449.  
  450.  
  451.   occur in any field in a macro body source line. The name is
  452.  
  453.  
  454.   recognized if it is bracketed by two of the following macro
  455.  
  456.  
  457.   delimiter characters:
  458.  
  459.  
  460.  
  461.      space  +  -  *  /  (  )  &  ,  =  "
  462.  
  463.  
  464.  
  465.       A macro must be defined prior to its call. A macro defined by
  466.  
  467.  
  468.   program source lines (including INCLUDE source lines) is
  469.  
  470.  
  471.   considered a user macro.  A macro defined thru inclusion of a
  472.  
  473.  
  474.   preassembled macro file (see INCLUDES) is considered a system
  475.  
  476.  
  477.   macro. By default MAC.68K does not list either user or system
  478.  
  479.  
  480.   macro call expansions. See LIST for the appropriate macro list
  481.  
  482.  
  483.   option.
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491. IV. (deleted)
  492. IV.
  493. IV.
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503. MAC.68K                                  -10-
  504.  
  505.  
  506.  
  507. MAC.68K
  508.  
  509.  
  510.  
  511.  
  512.  
  513. V.  PROGRAM LIST FORMATS AND LIST CONTROL
  514. V.  PROGRAM LIST FORMATS AND LIST CONTROL
  515. V.  PROGRAM LIST FORMATS AND LIST CONTROL
  516.  
  517.  
  518.  
  519.  
  520.       MAC.68K does not automatically list every line of input to
  521.  
  522.  
  523.   the output device.  Each line is categorized by its origin type
  524.  
  525.  
  526.   (e.g., a line from an included text file, a line generated by a
  527.  
  528.  
  529.   macro, etc) and is listed only if the appropriate list options
  530.  
  531.  
  532.   are currently enabled. Pseudo op LIST controls the active list
  533.  
  534.  
  535.   options.
  536.  
  537.  
  538.  
  539.       Output is formatted either for an 80 column device or a 120
  540.  
  541.  
  542.   column device.  The console is assumed to be 80 columns wide and
  543.  
  544.  
  545.   everything else 120.  This may be overridden by the PAGE
  546.  
  547.  
  548.   initialization pseudo op. When going to an 80 column output
  549.  
  550.  
  551.   device, any data characters beyond column 80 are by default
  552.  
  553.  
  554.   truncated. When overridden by the OPTION WRAP, columns 81 thru
  555.  
  556.  
  557.   120 are printed on the next line beginning in column position
  558.  
  559.  
  560.   32.
  561.  
  562.  
  563.  
  564.       By default output is paged with a one line header, one blank
  565.  
  566.  
  567.   line, and 58 source lines per page. An optional two line header
  568.  
  569.  
  570.   format or no header at all may be selected by using OPTION. Lines
  571.  
  572.  
  573.   per page may be reset using the PAGE pseudo op. The page line
  574.  
  575.  
  576.   fields are:
  577.  
  578.  
  579.  
  580.     First header line
  581.  
  582.  
  583.  
  584.   columns  1 - 32          64 - 83          88 - 107       112 - 120
  585.  
  586.  
  587.           Title           Version #        Date/Time        PAGE nnn
  588.  
  589.  
  590.  
  591.     Second header line
  592.  
  593.  
  594.  
  595.   columns  1 - 32         64 - 83           88 - 95        112 - 120
  596.  
  597.  
  598.        Subtitle          Subheading        QUAL Name
  599.  
  600.  
  601.  
  602.     Source line output
  603.  
  604.  
  605.  
  606.   columns  1 - 2         3 - 8             9 - 30           31 - 120
  607.  
  608.  
  609.        Error Flags    Location Address   Machine Code    Source line
  610.  
  611.  
  612.  
  613.  
  614.       In 80 column mode the first header line is compressed by
  615.  
  616.  
  617.   dropping the date/time field and replacing it with the page
  618.  
  619.  
  620.   number field.
  621.  
  622.  
  623.  
  624.       Two optional fields for the source line output are sequence
  625.  
  626.  
  627.   numbers and sequence names.  If selected via OPTION, these fields
  628.  
  629.  
  630.   are inserted so they end in column 120.  Sequence numbers are not
  631.  
  632.  
  633.   always sequential with an assembler that can INCLUDE other text
  634.  
  635.  
  636.   files or can generate source lines itself with MACRO or DUP. Each
  637.  
  638.  
  639.   INCLUDE file or call to a macro generates a new block of code
  640.  
  641.  
  642.   starting with sequence number 1. The old number sequence is
  643.  
  644.  
  645.   resumed when the inserted block of code terminates. The optional
  646.  
  647.  
  648.   sequence name reflects the source of the code. For source input
  649.  
  650.  
  651.   or INCLUDE it is the file name, for macros it is the macro name,
  652.  
  653.  
  654.   and for DUP it is DUP**.
  655.  
  656.  
  657.  
  658.  
  659.  
  660.                               -11-                              MAC.68K
  661.  
  662.  
  663.  
  664.                                                                 MAC.68K
  665.  
  666.  
  667.  
  668.  
  669.  
  670.       When the console is used as the output device, MAC.68K will
  671.  
  672.  
  673.   pause after a page is displayed on the screen and wait for a
  674.  
  675.  
  676.   keyboard input character before advancing to the next page.  The
  677.  
  678.  
  679.   character *S* or a ctl/C character will immediately terminate the
  680.  
  681.  
  682.   assembly. Any other character will cause MAC.68K to continue
  683.  
  684.  
  685.   assembling until the next page is full or the assembly is
  686.  
  687.  
  688.   complete.  The OPTION NOPAWS will disable the pause feature and
  689.  
  690.  
  691.   the output will scroll continuously until the assembly finishes.
  692.  
  693.  
  694.   Note that the standard CPM-68K console control keys ctl/S and
  695.  
  696.  
  697.   ctl/Q may also be used to stop and continue output.
  698.  
  699.  
  700.  
  701.       A printed symbol table must be explicitly requested via an
  702.  
  703.  
  704.   OPTION.  OPTION CROSSREF will generate symbol cross references
  705.  
  706.  
  707.   and list these symbol references sorted by page and output line
  708.  
  709.  
  710.   number when it lists the symbol table.  OPTION SYMBOL will
  711.  
  712.  
  713.   generate the same sorted symbol table that lists each symbol and
  714.  
  715.  
  716.   its value, but not any cross references.
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723. VI.  PROGRAM STRUCTURE
  724. VI.  PROGRAM STRUCTURE
  725. VI.  PROGRAM STRUCTURE
  726.  
  727.  
  728.  
  729.  
  730.       The minimum executable program on the Macintosh is:
  731.  
  732.  
  733.  
  734.             ExitToShell          ;RESTART THE FINDER APPLICATION
  735.  
  736.  
  737.            .END
  738.  
  739.  
  740.  
  741.  
  742.       MAC.68K requires all programs to end with an END card, and to
  743.  
  744.  
  745.   optionally begin with an IDENT card.  The IDENT/END pair brackets
  746.  
  747.  
  748.   the program text and provides some guarantee of program
  749.  
  750.  
  751.   completeness.  Some of the MAC.68K pseudo ops are used only for
  752.  
  753.  
  754.   initialization of assembly values, and must appear immediately
  755.  
  756.  
  757.   following the IDENT card (if present) but prior to any
  758.  
  759.  
  760.   non-initialization operation or pseudo operation code.  These
  761.  
  762.  
  763.   pseudo ops are:
  764.  
  765.  
  766.        OPTION  MODULE  STEXT  INCLUDES
  767.  
  768.  
  769.   If they appear later in the program they are flagged with an
  770.  
  771.  
  772.   error and are not processed. Pseudo op PAGE may be used anywhere
  773.  
  774.  
  775.   in the program. When used to initialize page width and/or page
  776.  
  777.  
  778.   length, it must appear as an initializtion pseudo op.
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797. MAC.68K                                  -12-
  798.  
  799.  
  800.  
  801. MAC.68K
  802.  
  803.  
  804.  
  805.  
  806.  
  807. VII.  FILE NAMES AND EXTENSIONS
  808. VII.  FILE NAMES AND EXTENSIONS
  809. VII.  FILE NAMES AND EXTENSIONS
  810.  
  811.  
  812.  
  813.  
  814.       File names supported by MAC.68K are limited to 8 characters
  815.  
  816.  
  817.   in length with an optional extension (a . followed by up to 3
  818.  
  819.  
  820.   characters). Imbedded spaces within a file name or extension are
  821.  
  822.  
  823.   not supported.  The input source file may have any file
  824.  
  825.  
  826.   extension, although .S is recommended. The input file name, the
  827.  
  828.  
  829.   object file name specified with the -O command, and the output
  830.  
  831.  
  832.   file name specfied with the > command line parameter are the only
  833.  
  834.  
  835.   file names that are not assigned explicit file name extensions by
  836.  
  837.  
  838.   MAC.68K.
  839.  
  840.  
  841.  
  842.       If present, the program name from the IDENT card is used as
  843.  
  844.  
  845.   the base file name for the generated object file. Based on
  846.  
  847.  
  848.   whether it is a program, module, or definition table assembly the
  849.  
  850.  
  851.   object file extension is .68K, .MOD, or .STX .
  852.  
  853.  
  854.  
  855.       File names used by the include pseudo ops may optionally
  856.  
  857.  
  858.   specify device names and extension names. Included text files are
  859.  
  860.  
  861.   assumed to have a blank extension. The extensions .MOD and .STX
  862.  
  863.  
  864.   are assumed by INCLUDEH and INCLUDES.
  865.  
  866.  
  867.  
  868.       The console is referenced with file name CON:  and the
  869.  
  870.  
  871.   printer with name LST:.
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.                               -13-                              MAC.68K
  909.  
  910.  
  911. 
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.                               -13-